<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>精准询价</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style_zj.css">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
</head>
<body>
<!--<div id="header_01_html">
    <iframe id="header_01" src="head_01.html" frameborder="0"></iframe>
</div>-->
<div class="content-box">
    <!--<div id="left_tab_html">
        <iframe id="left_tab" src="left_tab.html?x=4&y=1" frameborder="0"></iframe>
    </div>-->
    <div class="right-box layui-form" id="vue-box">
        <div class="friend-tips">
            <div class="title-box"><i class="icon-sty"></i><b class="title-tip">温馨提示</b></div>
            <div class="info-list">1、请正确填写以下信息，我们将尽快为您审核！</div>
            <div class="info-list">2、*为必填项，同时提示您尽量完整，详细的填写以下信息，以提高广大配件人对您所发信息的关注度</div>
        </div>
        <div class="content-admin">

            <div class="title-toggle">
                <div class="item"><a href="sign_info.html">管理企业基本信息</a></div>
                <div class="item active"><a href="">修改联系方式</a></div>
            </div>
            <div class="input-box1 sign-info" style="padding-left: 0;">
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4">*</span><span class="text-sty1">真实姓名</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="name" >
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">电子邮箱</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="email">
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4">*</span><span class="text-sty1">手机号码</span></div>
                    <div class="right-v mr-20">
                        <input type="text" class="layui-input" v-model="phone">
                        <span class=""></span>
                    </div>
                    <input type="checkbox" checked name="type" class="js-showP" title="公开手机" lay-skin="primary" value="0">
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">固定电话</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="telephone">
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">qq</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="qq">
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">传真</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="portraiture">
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4">*</span><span class="text-sty1">所属地区</span></div>
                    <!--<div class="select-sty1" style="width: 160px;">-->
                        <!--<div class="layui-form">-->
                            <!--<select name="city" lay-verify="" class="js-area1" lay-filter="test1">-->
                                <!--<option value="">请选择</option>-->
                            <!--</select>-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="select-sty1" style="width: 160px;">-->
                        <!--<div class="layui-form">-->
                            <!--<select name="city" lay-verify="" class="js-area2" lay-filter="test2">-->

                            <!--</select>-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="select-sty1" style="width: 160px;">-->
                        <!--<div class="layui-form">-->
                            <!--<select name="city" lay-verify="" class="js-area3" lay-filter="test3">-->

                            <!--</select>-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="select-sty1" style="width: 160px;">
                        <div class="layui-form">
                            <select name="province" id="province" lay-filter="province">
                                <option value="">省</option>
                            </select>
                        </div>
                    </div>
                    <div class="select-sty1" style="width: 160px;">
                        <div class="layui-form">
                            <select name="city" id="city" lay-filter="city">
                                <option value="">市</option>
                            </select>
                        </div>
                    </div>
                    <div class="select-sty1" style="width: 160px;">
                        <div class="layui-form">
                            <select name="area" id="area" lay-filter="myselect3">
                                <option value="">区</option>
                            </select>
                        </div>
                    </div>




                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">详细地址</span></div>
                    <div class="right-v">
                        <input type="text" class="layui-input" v-model="detailArea">
                        <span class=""></span>
                    </div>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1">公司官网</span></div>
                    <div class="right-v mr-20">
                        <input type="text" class="layui-input" v-model="skypegmwcn">
                    </div>
                    <span class="mr-20">格式例如：www.ziselu.com</span>
                </div>
                <div class="li clearfix">
                    <div class="left-k"><span class="col-ff4"></span><span class="text-sty1"></span></div>
                    <div class="detail-pic-text"><span class=""><span class="release-btn1 js-submit">确认修改</span></span><span style="top: 1px;" class=""></span></div>
                </div>


            </div>
        </div>
    </div>
</div>

<!--<div>
    <iframe src="footer-record.html" style="width: 100%;border: none;height:60px;"></iframe>
</div>-->
<script src="../js/config.js"></script>
<script>



    initAreaSelect()


    var storeId = localStorage.getItem("storeId");
    var app = new Vue({
        el: '#vue-box',
        data: {
            name:'',
            phone:'',
            detailArea:'',
            qq:'',
            provinceId:'',
            cityId:'',
            districtId:'',
            email:'',
            telephone:'',
            skypegmwcn:'',
            showPhone:'',
            portraiture:'',//传真
        },
        beforeCreate: function () {
            var that = this;
            get_ajax("/sys/store/view", {id:storeId},function (data) {
                that.name = data.fullName;
                that.phone = data.phone;
                that.detailArea = data.area;
                that.qq = data.qq;
                that.provinceId = data.provinceId;
                that.cityId = data.cityId;
                that.districtId = data.districtId;

                that.email = data.email;
                that.telephone = data.telephone;
                that.skypegmwcn = data.skypegmwcn;
                that.showPhone = data.showPhone;
                that.portraiture = data.portraiture;

                if(that.showPhone ==1){
                    $('.js-showP').attr('checked',false);
                    layui.use('form', function(){
                        var form = layui.form;
                        form.render("checkbox");
                    });
                }
                initLayuiArea(that.provinceId,that.cityId,that.districtId)

            })


        },
    })

//    3级地址联动

//    layui.use(['layer', 'form'], function(){
//        var form = layui.form;
//        ajax_async("/web/auth/getAreaList",{},function (data) {
//            var str = '';
//            data.forEach(function (item) {
//                str += '<option value="'+item.id+'">'+item.name+'</option>';
//            })
//            $(".js-area1").append(str);
//            $(".js-area1").val(app.provinceId);
////            $(".js-area2").val(app.cityId).trigger("change");
////            $(".js-area3").val(app.districtId);
//            form.render("select");
//        });
//        form.on('select(test1)', function(data){
//            ajax_async("/web/auth/getListByPid",{id:data.value},function (data) {
//                var str="";
//                data.forEach(function (item) {
//                    str += '<option value="'+item.id+'">'+item.name+'</option>';
//                })
//                $(".js-area2").html(str);
//                form.render("select");
//
//            });
//
//        });
//        form.on('select(test2)', function(data){
//            ajax_async("/web/auth/getListByPid",{id:data.value},function (data) {
//                var str="";
//                data.forEach(function (item) {
//                    str += '<option value="'+item.id+'">'+item.name+'</option>';
//                })
//                $(".js-area3").html(str);
//                form.render("select");
//
//            });
//
//        });
//
//    });


    $('.js-submit').on('click',function(){
        if(!app.name){
            layer.msg('姓名不能为空！')
            return
        }
//        if(!$('.js-area1').val()){
//            layer.msg('所属地区不能为空！')
//            return
//        }
//        if(!$('.js-area2').val()){
//            layer.msg('所属地区不能为空！')
//            return
//        }
//        if(!$('.js-area3').val()){
//            layer.msg('所属地区不能为空！')
//            return
//        }
        if(!app.qq){
            layer.msg('QQ号码不能为空！')
            return
        }
        if(!app.phone){
            layer.msg('手机号码不能为空！')
            return
        }
        if(!phone_rexg.test(app.phone)){
            layer.msg('手机号码不正确！')
        }

        console.log($('.js-showP').attr('checked'));

        get_ajax("/sys/store/addInfo", {
            id:storeId,
            fullName:app.name,
//            provinceId:$(".js-area1").val(),
//            cityId:$(".js-area2").val(),
//            districtId:$(".js-area3").val(),

            provinceId:$("#province").val(),
            cityId:$("#city").val(),
            districtId:$("#area").val(),

            address:app.detailArea,
            phone:app.phone,
            qq:app.qq,
            email:app.email,
            telephone:app.telephone,
            skypegmwcn:app.skypegmwcn,
            showPhone:$('.js-showP').attr('checked')?0:1,
            portraiture:app.portraiture,//传真


        }, function (data) {
            layer.msg('提交成功！');
            get_ajax("/web/auth/info",{},function (data) {
                if(data.storeId){
                    localStorage.setItem("storeId",data.storeId);
                }
            })
        })
    })



</script>
</body>
</html>